package com.xxxx.seckill.config;

import com.xxxx.seckill.pojo.User;

public class UserContext {
    //用户信息都存在自己线程中（公共线程存用户信息会导致信息紊乱）
    private static ThreadLocal<User> userHolder=new ThreadLocal<User>();

    public static void setUser(User user){
        userHolder.set(user);
    }

    public static User getUser(){
        return userHolder.get();
    }

}
